<template>
	<view class="search-info">
		<view class="input">
			<u-search placeholder="搜索" :show-action="false"  v-model="keyword" @blur="blur"></u-search>
		</view>
		<view class="big">
			<view class="box" v-for="(item,index) in searchData" :key="item.courseId" @click="naviget(item.courseId)">
				<image class="image" :src="item.bannerFileUrl"></image>
				<view class="word">
					{{item.courseTitle}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getGet} from "../../api/index.js"
	export default {
		data() {
			return {
				keyword: '',
				searchData:""
			};
		},
		methods:{
			blur(){
				getGet(`/pc/course/search/keyword?keyword=${this.keyword}`).then(res=>{
					console.log(res)
					this.searchData=res.data.courseList
				})
			},
			naviget(data){
				uni.navigateTo({
					url:`../detail/detail?id=${data}`
				})
			}
		}
	}
</script>

<style lang="less">
.search-info{
	
}
.input{
	padding: 15rpx;
	border-bottom: 1px solid #ddd;
}
.box{
	margin-bottom: 15rpx;
	display: flex;
	.word{
		width: 400rpx;
		margin-left: 15rpx;
	}
}
.big{
	padding: 15rpx;
}
.image{
	width: 250rpx;
	height: 150rpx;
}
</style>
